package com.uwlaser.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import com.uwlaser.base.CommonModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* @author liuzhihui
* @date 2022-03-27
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("sys_logs")
public class SysLogs extends CommonModel<SysLogs> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @TableId(type= IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "请求类名")
    private String clazzname;

    @ApiModelProperty(value = "请求方法")
    private String methodname;

    @ApiModelProperty(value = "请求参数")
    private String paramter;

    @ApiModelProperty(value = "返回参数")
    private String returns;

    @ApiModelProperty(value = "耗时")
    private Long elapsedtime;

    @ApiModelProperty(value = "请求时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createDate;

    @ApiModelProperty(value = "类型")
    private Boolean type;

    @ApiModelProperty(value = "异常类名")
    private String errorname;

    @ApiModelProperty(value = "异常信息")
    private String errormsg;

    public void copyFrom(SysLogs source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
